import java.util.Scanner;

public class PP11_1 {
    public static void main(String[] args) throws StringTooLongException
    {
        int Max = 20;
        Scanner scan = new Scanner(System.in);
        String str;

        StringTooLongException problem = new StringTooLongException("Input string is too long.");

        do {
            System.out.println("Enter an string:");
            str = scan.nextLine();
            System.out.println(str);
            if (str.length() > Max){
                throw problem;
            }
        }
        while (!str.equals("DONE"));






    }

}

